package com.kepe.dragon.persistent.dao;

import java.util.List;
import com.arti.dao.jade.annotation.DAO;
import com.arti.dao.jade.annotation.SQL;
import com.arti.dao.jade.annotation.SQLParam;
import com.kepe.dragon.persistent.domain.${entityName};

/**
* @author Jeremy
*/
@DAO
public interface ${entityName}DAO  {

	public static final String ID_FIELD	= " ${primary} ";
	public static final String TABLE = " ${tableName} ";
	public static final String FIELD = " ${fileds} ";

	/**
	 * 增
	 */
	@SQL("${insertSql}")
	public void insert(@SQLParam("ei") ${entityName} data);
	
	/**
	 * 改
	 */
	@SQL("${updateSql}")
	public int update(@SQLParam("ei") ${entityName} data);
	
	/**
	 * 删
	 */
	@SQL("${deleteAllSql}")
	public int delete(@SQLParam("playerId") long playerId);
	
	
	
	<#if iso2o>
	/**
	 * 根据id获取一条记录
	 */
	@SQL("SELECT "+FIELD+" FROM "+TABLE+" WHERE PlayerId= :playerId limit 1")
	public ${entityName} getOneById(@SQLParam("playerId") long playerId);
	<#else>
	/**
	 * 根据id获取所有记录
	 */
	@SQL("SELECT "+FIELD+" FROM "+TABLE+" WHERE playerId= :playerId")
	public List<${entityName}> getMoreById(@SQLParam("playerId") long playerId);
	</#if>
}
